package com.huanong.mapper;
/*
 *@Author:anran
 *@Date:2020/12/9
 *@Version 1.0
 */

import com.huanong.pojo.Person;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PersonMapper {

    @Select("select * from person where pnid=#{PnId}")
    Person queryById(Integer PnId);

    @Select("select * from person where pnaccount=#{PnAccount} and pnpassword=#{PnPassword}")
    Person login(Person person);

    @Insert("insert into person (pnname,pnsex,pnage,pnaccount,pnpassword,pncall,pnadd) " +
            "   values(#{PnName},#{PnSex},#{PnAge},#{PnAccount},#{PnPassword},#{PnCall},#{PnAdd})")
    int register(Person person);

    @Select("select * from person where pnaccount = #{account}")
    Person queryByAccount(@Param("account") String userAccount);
}
